-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make CompositeExpression immutable #3858
Conversation
@morozov BTW, should this be targeting 3.0 or 4.0? I can see all these breaking changes in the UPGRADE file targeting 3.0, but IIRC you said that there would not be large BC breaks in 3.0? Did I understand this right? |
These changes should be targeting master (4.0). The upgrade notes in |
Do you mean that some of the changes marked as 3.0 in the UPGRADE file should target 4.0? Should you update this file first? |
@@ -43,51 +47,10 @@ class CompositeExpression implements Countable | |||
*/ | |||
public function __construct(string $type, array $parts = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a future PR, I'd like the constructor to be made private
in favor of two named constructors — and()
and or()
— which would accept ($part, ...$parts)
and therefore not allow construction of an empty composite expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've mentioned that this is temporary in #3850 (comment). I'd like to complete immutability first, then move on to stop accepting empty parts. And you're right, factory methods will be a good idea!
Yes.
|
Thanks, @BenMorel! |
Continuing the work in #3850.